#!/bin/bash
$APPDIR/func -reset_gtk
export TEXTDOMAIN=pmusic
export OUTPUT_CHARSET=UTF-8
[ ! "$GTKDIALOG" ] && GTKDIALOG="gtkdialog" #puppy specific
if [ -z "$FRAME" ]; then FRAME=" "; fi
export WORKDIR=$HOME/.pmusic/tmp

export inputbox="
<window title=\"pMusic\" icon-name=\"pmusic\" window_position=\"2\">
 <vbox>
  <frame $FRAME>
   <pixmap icon_size=\"6\"><input file stock=\"gtk-$IMG\"></input></pixmap>
   <text use-markup=\"true\"><label>\"$TXT1\"</label></text>
   <entry activates-default=\"true\">
    <variable>INPUT</variable>
    <default>${DEFAULT}</default>
   </entry>
  </frame>
  <hbox>
   <button cancel></button>
   <button can-default=\"true\" has-default=\"true\" use-stock=\"true\">
    <input file icon=\"gtk-apply\"></input>
    <label>$(gettext 'Ok')</label>
    <action type=\"exit\">ok</action>
   </button>
  </hbox>
 </vbox>
</window>"
#make this workaround to allow `\ in filename
$GTKDIALOG -p inputbox > $WORKDIR/tmp
export INPUT="`grep -F 'INPUT=' $WORKDIR/tmp | cut -d'"' -f2`"
export EXIT="`grep -F 'EXIT=' $WORKDIR/tmp | cut -d'"' -f2`"
TXT1=""; DEFAULT=""; FRAME=""; IMG="" #reset to avoid alien text in next box
